import { createSlice, PayloadAction } from '@reduxjs/toolkit'
import type { MenuTheme } from 'antd'

interface ConfigState {
    theme: MenuTheme
}

const initialState: ConfigState = {
    theme: 'light'
}

export const configSlice = createSlice({
    name: 'configSlice',
    initialState,
    reducers: {
        updateTheme: (state, action: PayloadAction<MenuTheme>) => {
            state.theme = action.payload
        }
    }
})

export const { updateTheme } = configSlice.actions

export default configSlice.reducer

